package com.chinanet.oracle.entry;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

@Entity
@Table(name = "MONITOR_PERMISSION")
public class Permission implements Serializable {
    @Id
    @Column(name = "ID")
    private BigDecimal id;

    @Column(name = "PARENTID")
    private BigDecimal parentId;

    @Column(name = "NAME")
    private String name;

    @Column(name = "TYPE")
    private BigDecimal type;

    @Column(name = "URL")
    private String url;

    @Column(name = "ISENABLED")
    private BigDecimal isEnabled;

    @Column(name = "SORTNO")
    private BigDecimal sortno;

    @Column(name = "RESOURCESURL")
    private String resourcesUrl;

    @ManyToMany(cascade = CascadeType.MERGE)
    @JoinTable(name = "MONITOR_ROLE_PERMISSION", joinColumns = {
            @JoinColumn(name = "PERMISSIONID", referencedColumnName = "ID")
    }, inverseJoinColumns = {
            @JoinColumn(name = "ROLEID", referencedColumnName = "ID")
    })
    private List<Role> roles;

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public BigDecimal getParentId() {
        return parentId;
    }

    public void setParentId(BigDecimal parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getType() {
        return type;
    }

    public void setType(BigDecimal type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public BigDecimal getIsEnabled() {
        return isEnabled;
    }

    public void setIsEnabled(BigDecimal isEnabled) {
        this.isEnabled = isEnabled;
    }

    public BigDecimal getSortno() {
        return sortno;
    }

    public void setSortno(BigDecimal sortno) {
        this.sortno = sortno;
    }

    public String getResourcesUrl() {
        return resourcesUrl;
    }

    public void setResourcesUrl(String resourcesUrl) {
        this.resourcesUrl = resourcesUrl;
    }
}
